package wavenotes.guice;

import wavenotes.ImageServlet;
import wavenotes.PresentationServlet;
import wavenotes.SlideServlet;
import wavenotes.robot.NewRobotServlet;

import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener;
import com.google.inject.servlet.ServletModule;

public class MyGuiceServletConfig extends GuiceServletContextListener {

	@Override
	protected Injector getInjector() {
		ServletModule servletModule = new ServletModule() {
			@Override
			protected void configureServlets() {
				serveRegex("\\/_wave/.*").with(NewRobotServlet.class);
				serve("/presentation").with(PresentationServlet.class);
				serve("/slide").with(SlideServlet.class);
				serve("/image").with(ImageServlet.class);
			}
		};

		AbstractModule businessModule = new AbstractModule() {
			@Override
			protected void configure() {

			}
		};
		
		return Guice.createInjector(servletModule, businessModule);
	}
}
